import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserCoinLogVO, UserCoinLogForm, UserCoinLogQuery } from '@/api/business/userCoinLog/types';

/**
 * 查询用户硬币变动记录列表
 * @param query
 * @returns {*}
 */

export const listUserCoinLog = (query?: UserCoinLogQuery): AxiosPromise<UserCoinLogVO[]> => {
  return request({
    url: '/business/userCoinLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户硬币变动记录详细
 * @param id
 */
export const getUserCoinLog = (id: string | number): AxiosPromise<UserCoinLogVO> => {
  return request({
    url: '/business/userCoinLog/' + id,
    method: 'get'
  });
};

/**
 * 新增用户硬币变动记录
 * @param data
 */
export const addUserCoinLog = (data: UserCoinLogForm) => {
  return request({
    url: '/business/userCoinLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户硬币变动记录
 * @param data
 */
export const updateUserCoinLog = (data: UserCoinLogForm) => {
  return request({
    url: '/business/userCoinLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户硬币变动记录
 * @param id
 */
export const delUserCoinLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/userCoinLog/' + id,
    method: 'delete'
  });
};
